import request from '@/utils/request'

export function findProjectByPage(data, pageNum, pageSize) {
  return request({
    url: '/v1/project/findProjectByPage',
    method: 'get',
    params: {
      projectName: data.projectName,
      groupId: data.groupId,
      pageNum: pageNum,
      pageSize: pageSize
    }
  })
}

export function findProjectByGroup(groupId) {
  return request({
    url: '/v1/project/findByGroup',
    method: 'get',
    params: {
      groupId: groupId
    }
  })
}

export function findAll() {
  return request({
    url: '/v1/project/findAll',
    method: 'get'
  })
}

export function add(data, modules) {
  return request({
    url: '/v1/project/add',
    method: 'post',
    data: {
      projectName: data.projectName,
      groupId: data.groupId,
      code: data.code,
      describe: data.describe,
      modules: modules
    }
  })
}

export function edit(data, modules) {
  return request({
    url: '/v1/project/edit',
    method: 'put',
    data: {
      projectId: data.projectId,
      projectName: data.projectName,
      code: data.code,
      groupId: data.groupId,
      describe: data.describe,
      modules: modules
    }
  })
}

export function editModules(data, modules) {
  return request({
    url: '/v1/project/editModules',
    method: 'post',
    data: {
      projectId: data.projectId,
      groupId: data.groupId,
      modules: modules
    }
  })
}

export function active(groupId) {
  return request({
    url: '/v1/project/active/' + groupId,
    method: 'put'
  })
}

export function remove(groupId) {
  return request({
    url: '/v1/project/remove/' + groupId,
    method: 'delete'
  })
}
